<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title>启动</title>
		<script src="js/mui.min.js"></script>
		<script src="js/smarge.js"></script>
		<script type="text/javascript" charset="utf-8">
			mui.init();
		</script>
	</head>

	<body>
		<script type="text/javascript" charset="utf-8">
			mui.plusReady(function() {

				var all_webview = plus.webview.all();
				for(var j = 0; j < all_webview.length; j++) {
					if(all_webview[j].id !== plus.webview.currentWebview().id) {
						all_webview[j].close();
					}
				}

				var userinfo = Smarge.get('userinfo') || undefined;

				var tagetUrl, tagetId;
				if(userinfo == undefined) {
					tagetUrl = 'login.html';
					tagetId = 'login.html';
				} else {
					tagetUrl = 'main.html';
					tagetId = 'main.html';
				}

				var tagetWebView = mui.preload({
					url: tagetUrl,
					id: tagetId
				});

				//动画时间定义的长一点，以便页面加载好了再关闭启动界面
				tagetWebView.show("fade-in", 1000, function() {
					plus.navigator.closeSplashscreen();
				});

			});
		</script>

	</body>

</html>